package com.paradisecloudtech.vc.system.mvp.manager;


import com.common.library.retrofit.RetrofitHelper;
import com.paradisecloudtech.vc.system.mvp.bean.AddPartBean;
import com.paradisecloudtech.vc.system.mvp.bean.BookingBean;
import com.paradisecloudtech.vc.system.mvp.bean.CloseCofBean;
import com.paradisecloudtech.vc.system.mvp.bean.ConfInfoBean;
import com.paradisecloudtech.vc.system.mvp.bean.ConfsBean;
import com.paradisecloudtech.vc.system.mvp.bean.LoginResultBean;

import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import okhttp3.RequestBody;

public class ServiceManager {

    private ApiService apiService;

    public ServiceManager() {
        this.apiService = RetrofitHelper.getInstance().getRetrofit().create(ApiService.class);
    }

    public Observable<LoginResultBean> requestLoginData(RequestBody json) {
        return apiService.requestLoginData(json)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    public Observable<ConfsBean> requestConfsData(RequestBody json) {
        return apiService.requestConfsData(json)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    public Observable<BookingBean> bookingCof(RequestBody json) {
        return apiService.bookingCof(json)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    public Observable<CloseCofBean> closeCofBean(RequestBody json, int confid) {
        return apiService.closeCofBean(json, confid)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    public Observable<ConfInfoBean> getConfInfo(RequestBody json, int confid) {
        return apiService.getConfInfo(json, confid)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    public Observable<AddPartBean> addPart(RequestBody json, int confid) {
        return apiService.addPart(json, confid)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    public Observable<AddPartBean> disconParit(RequestBody json) {
        return apiService.disconParit(json)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }


}
